package com.qq.service;

import com.qq.entity.Student;

import java.util.Scanner;

/*
    @author:sa
    @date:2024/11/15 17:19
*/
public class StudentService {
    public Student[] stu = new Student[10];
    public int index = 0;

    public void one() {
        System.out.println("请输入姓名");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        Student student = new Student();
        student.name = name;
        System.out.println("请输入年龄");
        String age = scanner.nextLine();
        student.age = age;
        System.out.println("请输入性别");
        String sex = scanner.nextLine();
        student.sex = sex;
        stu[index] = student;
        index++;
    }

    public void four() {
        for (int j = 0; j < index; j++) {
            if (stu[j] != null) {
                Student student = stu[j];
                System.out.println("姓名："+student.name);
                System.out.println("年龄："+student.age);
                System.out.println("性别："+student.sex);
            }
        }
    }
}